#include "WarGameLib.h"



struct	wgGeoMMPatch
{
	float	distance;
	int		lod;
};


struct SGEOMM_NEIGHBOR
{
	bool m_bLeft, m_bUp, m_bRight, m_bDown;
};

class wgGeoMipmap
{
	wgHeightmap*	hm;
	int				PatchSize;
	int				NumPatchesX, NumPatchesZ;
	int				NumPatches;
	wgGeoMMPatch*		patches;
	int				MaxLOD;
	wgGeoMMPatch*	getPatch(int x, int z);
	int				getPatchNum(int x, int z);
	void RenderPatch(wgGeoMMPatch *pPatch, int x, int z);
	void RenderFan(float cx, float cz, float fSize, SGEOMM_NEIGHBOR& neighbor);
	void RenderVertex(float cx, float cz, float fMidX, float fMidZ);
public:
	wgGeoMipmap(wgHeightmap*);
	~wgGeoMipmap();
	void Update(wgCamera& cam);
	void Render(wgCamera& cam);

};